{template "header.html"}
<div class="note note-danger">
    <p><a href="javascript:dr_update_cache();">{dr_lang('更改数据之后需要更新缓存之后才能生效')}</a></p>
</div>
<form action="" class="form-horizontal" method="post" name="myform" id="myform">
    {$form}
    <div class="portlet bordered light myfbody">
        <div class="portlet-title tabbable-line">
            <ul class="nav nav-tabs" style="float:left;">
                <li class="{if $page==0}active{/if}">
                    <a href="#tab_0" data-toggle="tab" onclick="$('#dr_page').val('0')"> <i class="fa fa-cog"></i> {dr_lang('本站域名')} </a>
                </li>

                <li>
                    <a href="#tab_3" data-toggle="tab" onclick="dr_check_domain()"> <i class="fa fa-refresh"></i> {dr_lang('域名检测')} </a>
                </li>
            </ul>
        </div>
        <div class="portlet-body">
            <div class="tab-content">

                <div class="tab-pane {if $page==0}active{/if}" id="tab_0">
                    <div class="form-body">

                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('本站电脑域名')}</label>
                            <div class="col-md-9">
                                <label><input class="form-control input-large" type="text" name="data[site_domain]" value="{$data['site_domain']}"></label>
                                <span class="help-block">{dr_lang('本站的域名，通常www.xxx.com')}</span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('本站手机域名')}</label>
                            <div class="col-md-9">
                                <label><input class="form-control input-large" type="text" name="data[mobile_domain]" value="{$data['mobile_domain']}"></label>
                                <span class="help-block">{dr_lang('手机访问时的域名，通常m.xxx.com')}</span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('本站其他域名')}</label>
                            <div class="col-md-9">
                                <label><textarea class="form-control input-large" style="height:150px" name="data[site_domains]">{str_replace(',',PHP_EOL, $data['site_domains'])}</textarea></label>
                                <span class="help-block">{dr_lang('当前站点支持绑定多个域名，它们将会301到主域名，域名一行一个')}</span>
                            </div>
                        </div>
                        {if dr_is_app('member')}
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('用户中心电脑域名')}</label>
                            <div class="col-md-9">
                                <label><input class="form-control input-large" type="text" name="data[member_domain]" value="{$data['member_domain']}"></label>
                                <span class="help-block">{dr_lang('用户中心访问时的域名，通常member.xxx.com')}</span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('用户中心手机域名')}</label>
                            <div class="col-md-9">
                                <label><input class="form-control input-large" type="text" name="data[member_mobile_domain]" value="{$data['member_mobile_domain']}"></label>
                                <span class="help-block">{dr_lang('如果本站绑定了手机域名，这里必须要绑定域名')}</span>
                            </div>
                        </div>
                        {/if}

                    </div>
                </div>

                <div class="tab-pane {if $page==1}active{/if}" id="tab_1">
                    <div class="form-body form">

                        {loop $module $dir $t}
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('%s电脑域名', $t.name)}</label>
                            <div class="col-md-9">
                                {if $t.error}
                                <span class="help-block" style="color:#ed6b75;margin-top:7px;">{$t.error}</span>
                                {else}
                                <label><input class="form-control input-large" type="text" name="data[module_{$dir}]" value="{$data['module_'.$dir]}"></label>
                                {/if}
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('%s手机域名', $t.name)}</label>
                            <div class="col-md-9">
                                {if $t.error}
                                <span class="help-block" style="color:#ed6b75;margin-top:7px;">{$t.error}</span>
                                {else}
                                <label><input class="form-control input-large" type="text" name="data[module_mobile_{$dir}]" value="{$data['module_mobile_'.$dir]}"></label>
                                <span class="help-block">{dr_lang('如果本站绑定了手机域名，这里必须要绑定域名')}</span>
                                {/if}
                            </div>
                        </div>
                        {/loop}

                    </div>
                </div>

                <div class="tab-pane " id="tab_3">
                    <div class="form-body form">

                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('域名检测结果')}</label>
                            <div class="col-md-9">
                                <div id="dr_domain" style="margin-top: 8px;">

                                </div>
                            </div>
                        </div>


                    </div>
                </iv>

            </div>
        </div>
    </div>

    <div class="portlet-body form myfooter">
        <div class="form-actions text-center">
            <button type="button" onclick="dr_ajax_submit('{dr_now_url()}&page='+$('#dr_page').val(), 'myform', '2000')" class="btn green"> <i class="fa fa-save"></i> {dr_lang('保存')}</button>
        </div>
    </div>
</form>

<script>
    function dr_check_domain() {
        $.ajax({
            type: "POST",
            dataType: "text",
            url: "{dr_url('api/domain')}",
            data: $("#myform").serialize(),
            success: function(html) {
                $("#dr_domain").html(html);
            }
        });
    }

</script>

{template "footer.html"}